package demo2;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-09-10
 * Time: 14:51
 */
public class Test {
    public static void main2(String[] args) {
        Student[] students = new Student[3];
        students[0] = new Student("zhangsan",12);
        students[1] = new Student("lisi",10);
        students[2] = new Student("wangwu",19);

        System.out.println("排序前："+Arrays.toString(students));
        NameCompare nameCompare = new NameCompare();
        AgeCompare ageCompare = new AgeCompare();
        Arrays.sort(students,ageCompare);
        System.out.println("排序前："+Arrays.toString(students));
    }
    public static void main1(String[] args) {
        Student s1 = new Student("zhangsan",10);
        Student s2 = new Student("lisi",10);

//        System.out.println(s1.equals(s2));
        System.out.println(s1.compareTo(s2));
    }
}
